package com.yuand.controller;

import com.yuand.entity.SysUser;
import com.yuand.service.LoginService;
import com.yuand.utils.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: LoginController
 * @Author: yuandong
 * @Date 2022/1/14 15:21
 */
@RestController
@Slf4j
public class LoginController {
    @Autowired
    private LoginService loginService;
    /**
     * 用户登录
     * @param user
     * @return
     */
    @PostMapping("/login")
    public ResponseResult login(@RequestBody SysUser user){
        return loginService.login(user);
    }

    /**
     * 用户退出
     * @return
     */
    @PostMapping("/sys/logout")
    public ResponseResult logout(){
        return loginService.logout();
    }
}
